using System;
using System.Collections.Generic;
using System.Text;

namespace Deepcode.Flux.Core.Systems.UI.Menus
{
	/// <summary>
	/// Represents a menu link that will navigate the main application window.
	/// </summary>
	public class MenuApplicationLink : IMenuEntry
	{
		private string _HREF = "";
		private string _Caption = "";
		private System.Web.UI.Page _Owner = null;

		/// <summary>
		/// Construct a new link from the parameters specified - owner is used 
		/// to resolve the href - allowing ~/ url's to be used.
		/// </summary>
		/// <param name="owner"></param>
		/// <param name="href"></param>
		/// <param name="caption"></param>
		/// <param name="title"></param>
		public MenuApplicationLink(System.Web.UI.Page owner, string href, string caption)
		{
			_HREF = href;
			_Caption = caption;
			_Owner = owner;
		}
		/// <summary>
		/// Return the navigation url component.
		/// </summary>
		public string NavigateUrl
		{
			get
			{
				return _Owner.ResolveUrl(_HREF);
			}
		}
		/// <summary>
		/// Return the caption for the hyperlink
		/// </summary>
		public string Text
		{
			get
			{
				return _Caption;
			}
		}
		/// <summary>
		/// Return the target. As this is an application link - it opens in the
		/// application frame which removes the menus and utilises the maximum 
		/// screen real estate.
		/// </summary>
		public string Target
		{
			get
			{
				return "application";
			}
		}
	}
}
